package com.tanhua.manage.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.tanhua.manage.service.RegisteredService;
import com.tanhua.manage.vo.RetentionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @author zps
 * @date 2021/3/31
 * @TIME:10:09
 */
@RestController
@RequestMapping("/management")
@Slf4j
public class RegisteredController {
    @Autowired
    private RegisteredService registeredService;

    @GetMapping("/retention")
    public List<RetentionVo> getRetention(@RequestParam(name = "sd")String sd, @RequestParam(name = "ed")String ed){
        DateTime startDay = DateUtil.parse(sd, "yyyy-MM-dd");
        DateTime endDay = DateUtil.parse(ed, "yyyy-MM-dd");
        return  registeredService.retention(startDay,endDay);
    }
}
